<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ page import="ws.SPWebService"%>
<%@ page import="ws.WebServiceBean"%>
<%@ page import="project.utils.Utils"%>
<%@ page import="project.utils.Parser"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.HashMap"%>
<% 
	SPWebService sp = new SPWebService();
	WebServiceBean ws = sp.getWebServiceBeanPort(); 
%>
<head>
<title>Просмотр игроков</title>
<style type="text/css">
body,td,th {color: #F60;text-align: center;}
body {background-color: #000;}
a:link {color: #F60;text-decoration: none;}
a:visited {color: #F60;text-decoration: none;}
a:hover {text-decoration: none;color: #930;}
a:active {text-decoration: none;color: #930;}
</style>
<body>
	<div align="center">
		<h1>
			<font color="#00FF00">Список существующих игроков:</font>
		</h1>
	</div>
	<table border="1" width="700" align="center">
		<tr>
			<th width="50" scope="col"><h2>
					<font color="#00FF00">№</font>
				</h2></th>
			<th width="150" scope="col"><h2>
					<font color="#00FF00">Имя</font>
				</h2></th>
			<th width="200" scope="col"><h2>
					<font color="#00FF00">Фамилия</font>
				</h2></th>
			<th width="150" scope="col"><h2>
					<font color="#00FF00">Информация</font>
				</h2></th>
			<th width="150" scope="col"><h2>
					<font color="#00FF00">Изменить</font>
				</h2></th>
		</tr>
		<% 
 		String[][] responseArray = Utils.toArrays(ws.getAllPlayers());
  		ArrayList<HashMap<String, ArrayList<String>>> players = Parser.parse(responseArray);
  		for (int i=0; i<players.size();i++){
  			%>
		<tr>
			<td><%=i+1%></td>
			<td><%=players.get(i).get("firstname").get(0)%></td>
			<td><%=players.get(i).get("lastname").get(0)%></td>
			<td><a href=editPlayer.jsp?player_id=
				<%=players.get(i).get("id").get(0)%>>Получить полную<br>
					информацию
			</a></td>
			<td><a href=editPlayer.jsp?edit=ok&player_id=
				<%=players.get(i).get("id").get(0)%>>Редактировать игрока</a></td>
		</tr>
		<%
  		}
  	 %>
	</table>
</body>
</html>